﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Equality.Tests
{
    [TestClass]
    public class When_checking_equality_through_equal
    {
        [TestMethod]
        public void Given_two_different_objects_wo_equals_overload_then_they_should_not_be_equal()
        {
            Animal animal1 = new Animal() { Name = "Cat" };
            Animal animal2 = new Animal() { Name = "Dog" };

            bool areEqual = animal1.Equals(animal2);

            Assert.IsFalse(areEqual);
        }


        [TestMethod]
        public void Given_two_different_objects_w_equals_overload_then_they_should_not_be_equal()
        {
            var car = new Car() { Name = "Fiat" };
            var car1 = new Car() {Name = "Ford"};

            bool areEqual = car.Equals(car1);

            Assert.IsFalse(areEqual);
        }


        [TestMethod]
        public void Given_two_equivalentobjects_w_equals_overload_then_they_should_be_equal()
        {
            var car = new Car() { Name = "Ford" };
            var car1 = new Car() { Name = "Ford" };

            bool areEqual = car.Equals(car1); //Value equality

            Assert.IsTrue(areEqual);
        }
    }
}
